<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="zh-CN">
<c:set var="path" value="${pageContext.request.contextPath}"></c:set>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>流浪动物救助系统</title>
    <link href="${path}/user/static/css/style.css" rel="stylesheet">
    <link href="${path}/user/static/css/bootstrap.min.css" rel="stylesheet">

    <link rel="stylesheet" href="${path}/user/css/bootstrap.css" type="text/css" media="all">
    <!-- Bootstrap-Core-CSS -->
    <link rel="stylesheet" href="${path}/user/css/font-awesome.css" type="text/css" media="all">
    <!-- Font-Awesome-Icons-CSS -->
    <link rel="stylesheet" href="${path}/user/css/owl.carousel.css" type="text/css" media="all" />
    <!-- Owl-Carousel-CSS -->
    <link rel="stylesheet" href="${path}/user/css/style.css" type="text/css" media="all" />
    <!-- Style-CSS -->
    <!-- //css files -->
    <!-- web fonts -->
    <link href="http://fonts.googleapis.com/css?family=Molle:400i&amp;subset=latin-ext" rel="stylesheet">
    <link href="http://fonts.googleapis.com/css?family=Lato:100,100i,300,300i,400,400i,700,700i,900,900i&amp;subset=latin-ext" rel="stylesheet">
    <link href="http://fonts.googleapis.com/css?family=Raleway:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i&amp;subset=latin-ext"
          rel="stylesheet">
</head>

<body>
<jsp:include page="header.jsp"></jsp:include>

<!--幻灯片-->
<section class="ab_img">
    <img src="${path}/user/static/images/contact.jpg">
</section>

<!--联系-->
<div class="title1">
    <div class="title1_top">
        <h2>领养申请</h2>
    </div>
</div>
<div class="container">
    <div class="row">
        <div class="huanyanshow_con   col-sm-12 col-xs-12">

            <div class="form_3">
                <ul class="clearfix">
                    <li><span>领养动物姓名:  ${a.aName}</span> </li>
                    <li><span>领养者用户名:  ${user.uname}</span></li>
                    <li><span>姓名:  ${user.urealname}</span></li>
                    <li><span>手机 <i>*</i></span><input type="text" id="apPhone"/></li>
                    <li><span>预约时间 <i>*</i></span><input type="text" id="apTime"/></li>
                    <input type="hidden" id="apsuId" value="${a.uId}"/>
                </ul>
                <div class="text_a">
                    <span>领养理由<i>*</i></span><textarea name="" id="apReason"></textarea >
                </div>
                <a class="sum_b" id="appointment">立即提交</a>
            </div>
        </div>
    </div>
</div>

<!--联系我们-->
<footer class="footer">
    <div class="container">
        <div class="b-nav wow fadeInUp" data-wow-delay=".1s">
            <a href="index.html">首 页</a>
            <a href="about.html">关于我们</a>
            <a href="product.html">医疗设施</a>
            <a href="service.html">医疗服务</a>
            <a href="news.html">宠物百科</a>
            <a href="contact.html">联系我们</a>
        </div>
        <p class="wow fadeInUp jshu" data-wow-delay=".3s">Copyright © 2020-2020 宠物医院 | XX宠物医院</p>
        <p class="wow fadeInUp jshu" data-wow-delay=".5s">技术支持：&nbsp;&nbsp;&nbsp;
            <a href="http://www.17sucai.com/" target="_blank">网页模板</a>
        </p>
    </div>
</footer>
<!--回到顶部-->
<a class="top"><span class="glyphicon glyphicon-menu-up jiantou"></span></a>
<script src="${path}/user/static/js/jquery-3.1.1.min.js"></script>
<script src="${path}/user/static/js/bootstrap.min.js"></script>
<!-- layui的js-->
<script src="${path}/admin/layui/layui.js" charset="utf-8"></script>
<script>
    $(window).scroll(function(){
        $(".top").show();
        if($(window).scrollTop()<=300){
            $(".top").hide();
        }
    });
    $(".top").click(function(){
        $("html").animate({"scrollTop": "0px"},100); //IE,FF
        $("body").animate({"scrollTop": "0px"},100); //Webkit
    });
</script>
<script type="text/javascript">
    $(function () {
        layui.use(['laypage', 'layer'], function () {
            var laypage = layui.laypage, layer = layui.layer;

            $("#appointment").click(function () {
                if ($("#apPhone").val() == null || $("#apPhone").val() == "") {

                    layer.tips("预约手机号不能为空", "#apPhone")

                } else if ($("#apTime").val() == null || $("#apTime").val() == "") {

                    layer.tips("预约时间不能为空", "#apTime")

                }else if ($("#apReason").val() == null || $("#apReason").val() == "") {

                    layer.tips("预约领养理由不能为空", "#apReason")

                } else if ($("#apPhone").val() != null && $("#apPhone").val() != ""  &&$("#apTime").val() != null && $("#apTime").val() != "" &&$("#apReason").val() != null && $("#apReason").val() != ""){
                    $.ajax({
                        url: "${path}/appointment/appointmentAdd02",
                        type: "post",
                        dataType: "json",
                        data:{
                            uId: "${user.uid}",
                            apPhone:$("#apPhone").val(),
                            apTime:$("#apTime").val(),
                            apReason:$("#apReason").val(),
                            apSuId:$("#apsuId").val(),
                            aId:"${a.aId}"
                    }, success: function (data) {
                            if (data.code == 0) {
                                layer.msg(data.msg, {icon: 1, time: 2000}, function () {
                                    //发表成功
                                    location.reload();
                                });
                            } else {
                                //发表失败
                                layer.msg(data.msg, {icon: 2, time: 2000}, function () {
                                    location.reload();
                                });
                            }

                        }
                    })
                }

            })

        });
    });
</script>

</body>

</html>
